IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[cms_sp_Content_Add]') AND type in (N'P', N'PC'))
	DROP PROCEDURE [dbo].[cms_sp_Content_Add]
GO
create procedure [dbo].[cms_sp_Content_Add]
(
@Id int = null output,
@SiteGroupId int = null,
@SiteId int = null,
@ContentTypeId int,
@SystemLanguageId int = null,
@ContentTitle nvarchar(250),
@ContentSummary nvarchar(500) = null,
@ContentBody nvarchar(max) = null,
@ContentCode nvarchar(150) = null,
@CreatedBy int,
@DateCreated datetime,
@LastUpdatedBy int = null,
@DateLastUpdated datetime = null,
@IsPublished bit = null,
@PublishEndDate datetime = null, 
@PublishStartDate datetime = null
)
as
insert into dbo.Contents
(
SiteGroupId,
SiteId,
SystemLanguageId,
ContentTypeId,
ContentTitle,
ContentSummary,
ContentBody,
CreatedBy,
DateCreated,
PublicContentId
)
values
(
@SiteGroupId,
@SiteId,
@SystemLanguageId,
@ContentTypeId,
@ContentTitle,
@ContentSummary,
@ContentBody,
@CreatedBy,
@DateCreated,
0
)
set @Id = SCOPE_IDENTITY()
update dbo.Contents
	set PublicContentId = @Id
where ContentId = @Id
return @Id


GO

